﻿Public Class GiaoVienDAO

    Public Shared Function SelectAll() As DataTable
        Dim strSQL As String = "select * from GIAOVIEN"
        Dim dt As DataTable
        dt = Provider.ExecQuery(strSQL)
        Return dt
    End Function

    Public Shared Sub Insert(ByVal _gv As GiaoVienDTO)
        Dim strSQL As String = "Insert into GIAOVIEN(HoTen, NgaySinh, GioiTinh, DiaChi, DienThoai, MaChuyenMon)Values('" & _gv.HoTen & "','" & _gv.NgaySinh & "','" & _gv.GioiTinh & "','" & _gv.DiaChi & "','" & _gv.DienThoai & "'," & _gv.MaChuyenMon & ")"
        Provider.ExecNoneQuery(strSQL)
    End Sub

    Public Shared Sub Delete(ByVal _gv As GiaoVienDTO)
        Dim strSQL As String = "delete from GIAOVIEN where MaGV = " & _gv.MaGV
        Provider.ExecNoneQuery(strSQL)
    End Sub

    Public Shared Sub Update(ByVal _gv As GiaoVienDTO)
        Dim strSQL As String = "Update GIAOVIEN set HoTen = '" & _gv.HoTen & "', NgaySinh = '" & _gv.NgaySinh & "', GioiTinh = '" & _gv.GioiTinh & "', DiaChi = '" & _gv.DiaChi & "', DienThoai = '" & _gv.DienThoai & "', MaChuyenMon = " & _gv.MaChuyenMon & " where MaGV = " & _gv.MaGV
        Provider.ExecNoneQuery(strSQL)
    End Sub
End Class
